package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;
import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iTicketDAO;
import xupt.se.ttms.model.Ticket;

public class TicketSrv {

	private iTicketDAO ticketDAO=DAOFactory.creatTicketDAO();
	
	public boolean add(Ticket ticket) throws Exception{
		
			return ticketDAO.execInsert(ticket);
	}
	
	public boolean modify(Ticket ticket) throws Exception{
		return ticketDAO.execUpdate(ticket); 		
	}
	
	public boolean delete(int ID) throws Exception{
		return ticketDAO.execDelete(ID);		
	}
	
	public List<Ticket> Fetch(String condt) throws Exception{
		ResultSet resultSet=ticketDAO.execQuery(condt);	
		return ticketDAO.HandleTicketResultSet(resultSet);	
	}
	public List<Ticket> Fetch(int ticket_id) throws Exception{
		ResultSet resultSet=ticketDAO.execQuery(ticket_id);	
		return ticketDAO.HandleTicketResultSet(resultSet);	
	}
	public List<Ticket> FetchAll() throws Exception{
		ResultSet resultSet=ticketDAO.exexQueryAll();
		return ticketDAO.HandleTicketResultSet(resultSet);			
	}
}